package com.whu.tcx01.hd.calmap;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class NodeBean implements Writable {
    private long nodeid;
    private double x;
    private double y;


    public long getNodeid() {
        return nodeid;
    }

    public void setNodeid(long nodeid) {
        this.nodeid = nodeid;
    }

    public double getX() {
        return x;
    }

    public void setX(double x) {
        this.x = x;
    }

    public double getY() {
        return y;
    }

    public void setY(double y) {
        this.y = y;
    }

    public NodeBean() {
    }

    //序列化的顺序和反序列化的顺序必须一致
    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeLong(nodeid);
        dataOutput.writeDouble(x);
        dataOutput.writeDouble(y);
    }

    //反序列化的顺序
    @Override
    public void readFields(DataInput dataInput) throws IOException {
        this.nodeid = dataInput.readLong();
        this.x = dataInput.readDouble();
        this.y =  dataInput.readDouble();
    }

}
